package com.arvinclub.service.service;

import com.arvinclub.model.entity.Comment;
import com.arvinclub.service.dao.CommentDao;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 评论Service层
 */
@Service
public class CommentService {

    @Resource
    private CommentDao commentDao;

    /**
     * 通过comment_id返回评论
     */
    public Comment backCommentById(int id) {
        return commentDao.backCommentById(id);
    }

    /**
     * 添加评论
     */
    public void addComment(Comment comment) {
        commentDao.addComment(comment.getBlog().getId(), comment.getUser().getId(), comment.getContent(), comment.getTime());
    }

    /**
     * 删除评论
     */
    public void delComment(int id) {
        commentDao.delComment(id);
    }

    /**
     * 编辑评论
     */
    public void updateComment(Comment comment) {
        commentDao.updateComment(comment);
    }
}
